from django.db import models


# Create your models here.
# 演员
class Actor(models.Model):
    GENDER = (
        (0, '女'),
        (1, '男')
    )
    # 名字, 年龄, 性别
    name = models.CharField('姓名', max_length=24)
    age = models.IntegerField('年龄', default=1)
    gender = models.SmallIntegerField('性别', choices=GENDER, default=0)
    movie_count = models.IntegerField('参演电影数量', default=0)

    "movie_set"

    def __str__(self):
        return self.name

class Movie(models.Model):
    title = models.CharField('片名', max_length=24)
    img = models.ImageField('封面', upload_to='movie')
    play_date = models.DateField('上映时间', auto_now_add=True)
    actor = models.ManyToManyField(Actor, null=True, blank=True)

    def __str__(self):
        return self.title